package cn.iocoder.yudao.module.def.service.project;

import java.util.*;
import java.util.function.Function;

import cn.iocoder.yudao.module.def.controller.admin.project.vo.*;
import cn.iocoder.yudao.module.def.dal.dataobject.project.ProjectDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

/**
 * 工程 Service 接口
 *
 * @author 芋道源码
 */
public interface ProjectService {

    /**
     * 创建工程
     *
     * @param createReqVO 创建信息
     * @return 编号
     */
    Integer createProject(@Valid ProjectSaveReqVO createReqVO);

    /**
     * 更新工程
     *
     * @param updateReqVO 更新信息
     */
    void updateProject(@Valid ProjectSaveReqVO updateReqVO);

    /**
     * 删除工程
     *
     * @param id 编号
     */
    void deleteProject(Integer id);

    /**
     * 获得工程
     *
     * @param id 编号
     * @return 工程
     */
    ProjectDO getProject(Integer id);

    /**
     * 获得工程分页
     *
     * @param pageReqVO 分页查询
     * @return 工程分页
     */
    PageResult<ProjectDO> getProjectPage(ProjectPageReqVO pageReqVO);

    /**
     * 经费投入分布
     * @return
     */
    Map<String, Object> selectInvestmentsGroupedByCity(String city);

    /**
     * 项目年增长
     * @return
     */
    List<Map<String, Object>> selectProjectCountsByCityAndYear(String city,String xmType);

    /**
     * 总体情况数据格式
     * @param city
     * @return
     */
    List<Map<String, Object>> getOverallSituationNum(String city);

    /**
     * 项目类型统计
     * @return
     */
    List<Map<String, Object>> getProjectTypeNum(String city,String xmType);

    List<ProjectDO> selectAll(ProjectPageImportReqVO pageReqVO);

    /**
     * 项目在建率、项目完工率、资金支付率格式相同
     * @return
     */
    List<Map<String, Object>> selectProjectBuildingCountsByCity(String yearTime,String city);

    /**
     * 地图点位数据
     * @return
     */
    List<Map<String, Object>> selectProjectsWithCategory(String starTime,String endTime,String city);

    /**
     * 地图点击详情
     * @return
     */
    List<Map<String, Object>> getSummaryDataByCity(String cityName,String starTime,String endTime);

    List<Map<String, Object>> getFormattedProjectCompletionRateByCity(String yearTime,String city);

    List<Map<String, Object>> selectProjectFundCountsByCity(String yearTime,String city);

    ImportRespVO importUserList(Map<String, List<ProjectRespVO>> list);

    List<Map<String,String>> getCity();

    List<Map<String,String>> getCityForSearch();

    Map<String, List<ProjectRespVO>> importExcel(MultipartFile file);

    Map<String, Pair<List<?>, Class<?>>> importExcel(MultipartFile file,
                                                     Function<String, Class<?>> sheetTypeMapper);

    List<ProjectRespVO> getProjectList(ProjectPageReqVO reqVO);

    void deleteBatch(List<Integer> ids);

    void exportProjectExcel(ProjectPageReqVO pageReqVO, HttpServletResponse response);

    void dealImportFile(MultipartFile file);

    List<String> importExcelDevice(MultipartFile file);

    List<Map<String, Object>> getDeviceNum(String xmType, String city);
}